<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<f:view>
<html>
<head>
<title>Java Programming</title>
<link rel="shortcut icon" href="images/idenewlogo.png">
<link href="style/idestyles.css" type="text/css" rel="stylesheet"></link>
	<script type="text/javascript">
		function getSelUser(rowIndex,param){
			if(param=='delete'){
				var file = confirm("Are You Sure You Want To Delete   " + document.getElementById('onlineIDEAdminId:dataTableId:'+rowIndex+':userNameId').innerHTML + "  User ?");
			  if(file){
				  //alert("Are You Sure To Delete This Java File");
				  document.getElementById('onlineIDEAdminId:selectedUser').value = document.getElementById('onlineIDEAdminId:dataTableId:'+rowIndex+':userNameId').innerHTML;
				 // alert(document.getElementById('onlineIDEAdminId:selectedUser').value);
				  return true;
			  }else{
					//alert("inside else");
				  return false;  
			  }
			  
	     	}  
			document.getElementById('onlineIDEAdminId:selectedUser').value = document.getElementById('onlineIDEAdminId:dataTableId:'+rowIndex+':userNameId').innerHTML;
			//alert(rowIndex);
			//alert(document.getElementById('myJavaForm:dataTableId:'+rowIndex+':classNameId').innerHTML);
			//document.getElementById('myJavaForm:hiddenFullPath').value = document.getElementById('myJavaForm:dataTableId:'+rowIndex+':classNameId').innerHTML;
			return true;
		}
	</script>
</head>
<body>
	<h:form id="onlineIDEAdminId">
		<div style="width: 400%; overflow: hidden;">
			<h:panelGroup>
				<h:outputLabel value="Current User Count:"><h:outputText value="#{onlineIDEAdmin.userCount}"></h:outputText></h:outputLabel>
			</h:panelGroup>
			<h:panelGroup>
				<h:commandLink value="GoToLoginPage" action="#{onlineIDEAdmin.goToLoginPage}"/>
			</h:panelGroup>
				<t:dataTable var="userNameVar" rowIndexVar="currentRow" 
							 id="dataTableId" style="text-align=center;width: 739px"
							 value="#{onlineIDEAdmin.usersList}" rows="500" 
							 bgcolor="#F1F1F1" border="10" cellpadding="5" cellspacing="3"
							 frame="hsides" rules="all" width="50%"
							 rowClasses="TableRow1,TableRow2" columnClasses="TableColumn"
							 styleClass="TableClass" headerClass="TableHeader" footerClass="TableFooter"
							 >
					<f:facet name="header">
							<h:outputText value="Online IDE Admin Information" />
					</f:facet>
									
					<t:column style="color:green; font-weight:bold" headerstyle="background-color:#99CCFF;">
	      							<f:facet name="header"><h:outputText style="white-space:nowrap" value="User Name"/></f:facet>
	      							<h:outputText id="userNameId" style="align:right; font-size: 12pt" value="#{userNameVar.userName}"/>
	      			</t:column>
	      			<t:column style="color:green; font-weight:bold" headerstyle="background-color:#99CCFF;">
	      							<f:facet name="header"><h:outputText style="white-space:nowrap" value="Folder Size"/></f:facet>
	      							<h:outputText id="folderSizeId" style="align:right; font-size: 12pt" value="#{userNameVar.folderSize}"/>
	      			</t:column>
	      			<t:column style="color:green; font-weight:bold" headerstyle="background-color:#99CCFF;">
	      							<f:facet name="header"><h:outputText style="white-space:nowrap" value="Last Modified Date"/></f:facet>
	      							<h:outputText id="lastModDateId" style="align:right; font-size: 12pt" value="#{userNameVar.lastModDate}"/>
	      			</t:column>
	      			<t:column style="color:green; font-weight:bold" headerstyle="background-color:#99CCFF;">
	      							<f:facet name="header"><h:outputText style="white-space:nowrap" value="Delete"/></f:facet>
	      							<h:commandButton id="deleteId" style="align:right; font-size: 12pt" value="Delete User" action="#{onlineIDEAdmin.deleteUser}" onclick="return getSelUser('#{currentRow}','delete')" title="click to Delete user"/>
	      			</t:column>
	      			<t:column style="color:green; font-weight:bold" headerstyle="background-color:#99CCFF;">
	      							<f:facet name="header"><h:outputText style="white-space:nowrap" value="Open User"/></f:facet>
	      							<h:commandButton id="openId" style="align:right; font-size: 12pt" value="Open User" action="#{onlineIDEAdmin.openUser}" onclick="return getSelUser('#{currentRow}','open')" title="click to open user"/>
	      			</t:column>
					<f:facet name="footer">
									<h:outputText value="End of Users" />
					</f:facet>
						
						
				</t:dataTable>
				<h:inputHidden id="selectedUser" value="#{onlineIDEAdmin.selectedUser}"></h:inputHidden>	
		</div>	
	</h:form>
</body>
</html>
</f:view>